home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Games / dynAMIte / Developer / C / dynamite.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-22  |  8.0 KB  |  231 lines

  1. #ifndef DYNAMITE_H
  2. #define DYNAMITE_H
  3. /*
  4. **    $VER: dynamite.h 40.0 (3.6.2001)
  5. **
  6. */
  7.  
  8. #ifndef EXEC_NODES_H
  9. #include <exec/nodes.h>
  10. #endif /* EXEC_NODES_H */
  11.  
  12. #ifndef EXEC_LISTS_H
  13. #include <exec/lists.h>
  14. #endif /* EXEC_LISTS_H */
  15.  
  16. #ifndef EXEC_SEMAPHORES_H
  17. #include <exec/semaphores.h>
  18. #endif /* EXEC_SEMAPHORES_H */
  19.  
  20.  
  21. /* player->status */
  22. #define PA_NONE 0      /* no player */
  23. #define PA_VISI 1      /* visitor */
  24. #define PA_LOGGEDIN 2  /* just logged in/after a game */
  25. #define PA_PLAYING 3   /* is in game (no matter if he's dead) */
  26. #define PA_COUNTDOWN 4 /* this is of no use. players only have this status if they logged in. */
  27. #define PA_DEAD 5      /* this is of no use, it's not meant to see if a player is */
  28.                /* actually dead.  use player.dead instead.  it's only set */
  29.                /* after a successfull login for the other players */
  30. #define PA_WON 6       /* a player has this status if he won the last round */
  31.  
  32. /* dynasema->gamerunning */
  33. #define GAME_CLOSEGAME 0,  /* transitional state to GAME_MENU after connection got closed */
  34. #define GAME_MENU 1        /* game is in menu eg: login screen */
  35. #define GAME_ENDGAME 2     /* transitional state to GAME_MENU after effect has been drawn */
  36. #define GAME_EFFECT 3      /* game draws effect after a match */
  37. #define GAME_COUNTDOWN 4   /* game is doing the countdown */
  38. #define GAME_GAME 5        /* game is running */
  39. #define GAME_HURRYUP 6     /* game is running and is in hurry up mode */
  40. #define    GAME_NOTCONNECTED 7 /* game is not connected (startscreen) */
  41.  
  42. #define DIR_NONE    -1
  43. #define DIR_DOWN    0
  44. #define DIR_RIGHT    1
  45. #define DIR_LEFT    2
  46. #define DIR_UP        3
  47.  
  48. #define SPEED_NORMAL    4
  49. #define SPEED_SLOW    3
  50. #define SPEED_FAST    6
  51.  
  52. #define BLOCK_FAKEBLOCK        -1    /* used for remote/kick bombs which are placed into the map */
  53. #define BLOCK_NOBLOCK        0    /* empty field */
  54. #define BLOCK_HARDBLOCK        1    /* non-destroyable block */
  55. #define BLOCK_DESTROYABLE    2    /* destroyable block */
  56. #define BLOCK_BOMB        3    /* normal bomb */
  57. #define BLOCK_BORDERWALL1    4    /* borderblocks are equal to hardblock */
  58. #define BLOCK_BORDERWALL2    5
  59. #define BLOCK_BORDERWALL3    6
  60. #define BLOCK_BORDERWALL4    7
  61. #define BLOCK_BORDERWALL5    8
  62. #define BLOCK_BORDERWALL6    10
  63. #define BLOCK_BORDERWALL7    11
  64. #define BLOCK_BORDERWALL8    12
  65. #define BLOCK_BORDERWALL9    13
  66. #define BLOCK_BORDERWALL10    14
  67. #define BLOCK_BORDERWALL11    15
  68. #define BLOCK_BORDERWALL12    16
  69.  
  70. #define BLOCK_ADDBOMB    19    /* block which contains a bomb */
  71.  
  72. #define BO_EXPANDFLAME    1    /* types for bonusgrid */
  73. #define BO_ADDBOMB    2
  74. #define BO_FLAMEMAX    3
  75. #define BO_BOMBMAX    4
  76. #define BO_RANDOMWALL    5
  77. #define BO_BOMBS2BLOCKS    6
  78. #define BO_DROPALL    7
  79. #define BO_EXPLALL    8
  80. #define BO_FASTER    9
  81. #define BO_SLOWER    10
  82. #define BO_SHORTERFUSE    11
  83. #define BO_LONGERFUSE    12
  84. #define BO_SHORTERFLAME    13
  85. #define BO_SWAPCONTROLSRL    14
  86. #define BO_FEWERBOMBS    15
  87. #define BO_NODROP    16
  88. #define BO_SHIELD    17
  89. #define BO_STANDSTILL    18
  90. #define BO_TELEPORT    19
  91. #define BO_REMOTEBOMB    20
  92. #define BO_BACK2BASIC    21
  93. #define BO_KICKBOMB    22
  94. #define BO_SABER    23
  95. #define BO_SWAPCONTROLSUD    24
  96. #define BO_MAGNET    25
  97. #define BO_PHOENIX    26
  98. #define BO_DOHURRYUP    27
  99. #define BO_INVISIBLE    28
  100. #define BO_DUELL    29
  101. #define BO_AFTERBURNER    30
  102. #define BO_FLAG            31
  103. #define BO_TELEPORTALL        32
  104. #define BO_MAPJUMP        33
  105. #define BO_RESTARTMAP        34
  106. #define BO_SWAPPOSITIONS    35
  107. #define BO_MAX            36
  108.  
  109. #define BOMB_NORMAL    0    /* normal bomb */
  110. #define BOMB_GEN        1    /* predefinend bomb */
  111. #define BOMB_REMOTE    2    /* remote bomb */
  112. #define BOMB_KICK        3    /* kick bomb */
  113.  
  114. struct serverdata {
  115.   char servername[34]; /* name of the server */
  116.   char sysopname[18];  /* name of the sysop */
  117.   WORD maxslots;       /* how many players allows this server */
  118.   WORD maxobservers;   /* how many observers allows this server */
  119. };
  120.  
  121. struct tempbomb {
  122.     struct    MinNode ln;
  123.     WORD    x;        /* x blockpos */
  124.     WORD    y;        /* y blockpos */
  125.     WORD    x1;        /* x pos (pixel) */
  126.     WORD    y1;        /* y pos (pixel) */
  127.     WORD    fuse;        /* >0 bomb is still ticking, =0 bomb is going to explode */
  128.     LONG    range;        /* flamlength */
  129.     WORD    dir;        /* in case of kick/remote bomb holds the direction */
  130.     WORD    originx;    /* holds the x/y pos (block) where the bomb was placed */
  131.     WORD    originy;    /* (useful to find kick/remotebombs) */
  132.     WORD    type;        /* is set to one of BOMB_#? */
  133. };
  134.  
  135. struct player {
  136.     WORD    num;
  137.     LONG    status;
  138.     WORD    dead;
  139.     WORD    x;            /* xpos (pixel) + border (24 pixel) */
  140.     WORD    y;            /* ypos (pixel) + border (16 pixel) */
  141.     WORD    px;            /* xpos (block number) */
  142.     WORD    py;            /* ypos (block number) */
  143.  
  144.     WORD    bombc;            /* how many bombs this player has currently ticking */
  145.     WORD    maxkickbombs;        /* how many kickbombs this player has */
  146.     struct    MinList *bomblist;    /* doubly linked list of bombs belonging to this player */
  147.     struct    tempbomb *remotebomb;    /* pointer to a bomb of bomblist which is his remotebomb else 0 */
  148.     struct    tempbomb *kickbomb;    /* pointer to a bomb of bomblist which is his kickbomb else 0 */
  149.  
  150.     WORD    maxrange;    /* flamelen of player ranging from 2 to 15 */
  151.     WORD    maxbombs;    /* how many bombs this player can drop */
  152.     WORD    fuselen;    /* fuselength of bombs the player can drop */
  153.     WORD    speed;        /* player speed; SPEED_NORMAL=4, SPEED_SLOW=3, SPEED_FAST=6 */
  154.     WORD    speedc;        /* >0 = player has other speed (SPEED_SLOW, SPEED_FAST) */
  155.  
  156.     WORD    swaprlc;    /* >0 = swaped horizontal controls */
  157.     WORD    swapudc;    /* >0 = swaped vertical controls */
  158.     WORD    nodropc;    /* >0 = player can't drop bombs */
  159.  
  160.     WORD    shieldc;    /* >0 = player has shield */
  161.  
  162.     WORD    standstillc;    /* >0 = player can't move */
  163.  
  164.     WORD    invisiblec;    /* >0 = player is invisible */
  165.  
  166.     WORD    afterburnerc;    /* >0 = player has afterburner */
  167.  
  168.     WORD    b2bc;
  169.  
  170.     WORD    flamethrowerc;    /* >0 = player has lightsabre */
  171.     WORD    flamethrowerdir;    /* direction of lightsabre */
  172.     WORD    flamethrowerr;    /* range of light sabre */
  173.  
  174.     WORD    magnetc;    /* >0 = this player has magnet enabled */
  175.     WORD    magnetdir;    /* direction of magnet */
  176.  
  177.     char    name[34];    /* players name */
  178.     char    system[64];    /* players systemstring */
  179. };
  180.  
  181. struct dynamitesemaphore {
  182.     struct    SignalSemaphore sema;    /* embedded signalsemaphore */
  183.     LONG    opencnt;    /* you must increase this by 1 if you are going to use the */
  184.                 /* semaphore the first time. decrease it by 1 if you are done */
  185.  
  186.     LONG    quit;        /* dynamite will set this to 1 if it wants to quit.  Check this */
  187.                 /* from time to time and end your program if quit gets set to 1 */
  188.  
  189.     LONG    gamerunning; /* is set to one of GAME_#? */
  190.  
  191.     LONG    frames;        /* once a game is running this long will be increased by 1 */
  192.                 /* every frame. */
  193.  
  194.     LONG    walk;        /* set to one of DIR_ to make the player move or stop */
  195.     LONG    drop;        /* set to 1 to drop a bomb */
  196.     LONG    dropkick;    /* set to 1 to drop a kickbomb */
  197.  
  198.     LONG    thisplayer;    /* number of this player in playerarray (>7 = observer) */
  199.     struct    player *players[16];        /* array ptr of players (15 entries max; >7 = observer) */
  200.  
  201.     LONG    mapwidth;    /* holds the width of the map in blocks */
  202.     LONG    mapheight;    /* holds the height of the map in blocks */
  203.  
  204.     APTR    grid;        /* array ptr to the actual map (29 entries max). each entry contains 1 line of the map without powerups */
  205.     APTR    bonusgrid;    /* array ptr to the bonus map (29 entries max). each entry contains 1 line of the bonusmap */
  206.  
  207.     char    *addbubble; /* setting this pointer to a string will make dynamite */
  208.           /* show the string given here as bubble.  dynamite will */
  209.           /* reset this pointer to 0 after successfull creation of */
  210.           /* the bubble */
  211.  
  212.     struct serverdata *serverdata; /* see serverdata for details */
  213.  
  214.     APTR explosiongrid; /* array ptr to the explosion map (29 entries max). each entry contains 1 line of the explosion map */
  215.              /* this map reflects where currently explosions are (explosion=1) */
  216.              /* each element of line is CHAR sized */
  217.  
  218.     LONG version; /* holds the version of dynamite (e.g. 45) */
  219.  
  220.     APTR botinfo: /* pointer to an array of 255 (so 255 bots are supported
  221.            /* with this array) long pointers to hold a string */
  222.            /* (versioninfo, description) of your bot.  You should set */
  223.            /* the entry for your bot after opencnt has been increased */
  224.            /* by your bot and set it back to NULL if your bot is about */
  225.            /* to decrease the opencnt again on quit. */
  226.  
  227.            /* entry for your bot in this array is opencnt after */
  228.            /* increasing (on botstartup, see example) */
  229. };
  230. #endif
  231.